var express = require('express');
var router = express.Router();
const{ usernameIsExist_2, register_2 ,login} = require("../service/usersService")
/* GET home page. */
// 验证账号是否已存在
router.get('/usernameIsExist', async function(req, res, next) {
    let result = await usernameIsExist_2(req.query);
    res.send(result);
});

// 新用户注册
router.post('/register', async function(req, res, next) {
    let result = await register_2(req.body);
    res.send(result);
});

//用户登陆
router.post('/login', async function(req, res, next) {
    let result = await login(req.body);
    res.send(result);
    
});

module.exports = router;